<template>
  <div>
    <common-header :header="header"></common-header>
    <document-empty v-if="show"></document-empty>
    <document-have v-else></document-have>
  </div>
</template>

<script>
  import CommonHeader from "../Common/CommonHeader";
  import DocumentEmpty from './Common/DocumentEmpty';
  import DocumentHave from "./Common/DocumentHave";

  export default {
    name: "Documents",
    components: {
      CommonHeader,
      DocumentEmpty,
      DocumentHave,
    },
    data() {
      return {
        header: "我的作品",
        list: [],
        show: false
      }
    },
    methods:{
      getData() {
        let _this = this;
        let token = _this.getCookie("token");
        _this.$http.get(_this.apiUrl("user/users/getMySystem"), {headers: {'token': token}})
          .then((res) => {
            // console.log(res.data);
            _this.list = res.data.data;
          });
      },
    },
    mounted(){
      let _this = this;
      _this.getData();
      if(_this.list.length !== 0) _this.show = true;
    }
  }
</script>

<style>

</style>
